# 只查找Qt 6版本
file(GLOB QT6_VERSIONS "$ENV{HOME}/Qt/6.[0-9].[0-9]")
list(SORT QT6_VERSIONS)
list(REVERSE QT6_VERSIONS)
list(GET QT6_VERSIONS 0 LATEST_QT6)

# 打印检测到的Qt版本
get_filename_component(QT_VERSION "${LATEST_QT6}" NAME)
message(STATUS "Found Qt version: ${QT_VERSION}")

# 修改这行代码，将QT_DIR改为Qt6_DIR
set(Qt6_DIR "${LATEST_QT6}/macos/lib/cmake/Qt6" CACHE PATH "Path to Qt6 cmake configuration")
message(STATUS "Qt6_DIR: ${Qt6_DIR}")

# 修改检查条件
if(NOT EXISTS "${Qt6_DIR}")
    message(FATAL_ERROR "Qt6 config directory not found at: ${Qt6_DIR}")
endif()
